<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
 
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'sv_common.' . $phpEx);

// Basic parameter data
$mode		= request_var('mode', '');

if ($mode == 'corp_name')
{	
	$corp_id	= request_var('corp_id', '');
	
	$refered_price = get_refered_price($corp_id);
	
	if ($refered_price == 0.0)
	{
		echo '';
	}
	else
	{
		// The returned string is 'company name' + 1 space + 'refered stock price'.
		$str = get_corp_chinese_name($corp_id);
		$str .= ' ' . $refered_price;
	
		echo $str;
	}
}
if ($mode == 'username_exist')
{	
	$username	= request_var('username', '');

	$sql 	= 'SELECT * FROM ' . USERS_TABLE . ' WHERE username="' . $username . '"';
	$result = $db->sql_query_limit($sql,1); 
	if ($db->sql_fetchrow($result))
	{
		echo 1;	
	}
	else
	{
		echo 0;
	}
//	echo get_corp_chinese_name($corp_id);
}
if ($mode == 'email_exist')
{	
	$email	= request_var('email', '');
	
	$sql 	= 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_email="' . $email . '"';
	$result = $db->sql_query_limit($sql,1); 
	if ($db->sql_fetchrow($result))
	{
		echo 1;	
	}
	else
	{
		echo 0;
	}
//	echo get_corp_chinese_name($corp_id);
}
?>